package org.example.springboot.service;

import org.example.springboot.dao.InBoundMapper;
import org.example.springboot.dao.ReturnsMapper;
import org.example.springboot.model.InBound;
import org.example.springboot.model.Returns;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ReturnService {
    @Autowired
    private ReturnsMapper returnsMapper;

    public String insertReturn(String productName,String modelNumber, String supplierName,String quantity,String totalAmount, String returnType,String inOrderId, String outOrderId){
        returnsMapper.insertReturn(productName,modelNumber,supplierName,quantity,totalAmount,returnType,inOrderId,outOrderId);
        return "succeed";
    }

    public List<Returns> getAllReturns(){
        return returnsMapper.getAllReturns();
    }

    public List<Returns> findReturnByKeyword(String keyword){
        return returnsMapper.findReturnByKeyword(keyword);
    }

    public Returns getReturnById(int id){
        return returnsMapper.getReturnById(id);
    }

    public void deleteReturnById(int id){
        returnsMapper.deleteReturnById(id);
    }
}
